#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include <time.h>

/*无聊的小程序*/
struct food
{
    int x;
    int y;
    int foods;
};

struct food apple;

void gotoxy(int x, int y)             /*定位光标，x为行坐标,y为列坐标*/
{
    COORD pos = {x,y};
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOut, pos);
    return;
}

void print_food(void)
{
    apple.x =1 + rand() % 100;
    apple.y =1 + rand() % 100;
    gotoxy(apple.x,apple.y);
    printf("%c",apple.foods);
    return;
}

void First(void)
{
    srand((unsigned)time(NULL));
    apple.foods = '#';
    return;
}

int main(void)
{
    int index;
    int temp;
    First();
    printf("请输入随机种子数量:");
    scanf("%d",&index);
    for(temp = 0;temp < index;temp++)
    {
        print_food();
    }
    gotoxy(0,0);
    system("pause");
}
